programming4us
           
 
 
Programming

jQuery 1.3 : Headline rotator (part 3) - Setting up the rotator

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
11/28/2010 7:17:00 PM

Setting up the rotator

Since the visible news item will change over time, we'll need a way to easily keep track of which items are visible and where they are. First, we'll set two variables, one for the currently visible headline and one for the headline that has just scrolled out of view. Initially, both values will be 0.

var currentHeadline = 0, oldHeadline = 0;

Next, we'll take care of some initial positioning of the headlines. Recall that in the stylesheet we have already set the top property of the headlines to be 10 pixels greater than their container's height; because the container has an overflow property of hidden, the headlines are initially not displayed. It'll be helpful later on if we store that property in a variable, so that we can move headlines to this position when needed.

var hiddenPosition = $container.height() + 10;

We also want the first headline to be visible immediately upon page load. To achieve this, we can set its top property to 0.

$('div.headline').eq(currentHeadline).css('top', 0);

The rotator area of the page is now in the correct initial state:

Finally, we'll store the total number of headlines for later use and define a timeout variable to be used for the pause mechanism between each rotation.

var headlineCount = $('div.headline').length;
var pause;

There is no need yet to give pause a value at this time; it will be set each time the rotation occurs. Nevertheless, we must always declare local variables using var to avoid the risk of collisions with global variables of the same name.

Other -----------------
- jQuery 1.3 : Headline rotator (part1) - Setting up the page
- Benchmarking Current Rankingstages of SEO
- First Stages of SEO : Benchmarking Current Rankings
- First Stages of SEO : Benchmarking Current Indexing Status
- First Stages of SEO : Assessing Historical Progress
- First Stages of SEO : Determining Top Competitors
- Relevant IAM Standards and Protocols for Cloud Services (part 2)
- Relevant IAM Standards and Protocols for Cloud Services (part 1)
- Identity and Access Management : IAM Architecture and Practice
- Identity and Access Management : Why IAM?
- Identity and Access Management : Trust Boundaries and IAM
- Parallel Programming with Microsoft .Net : Parallel Tasks - The Default Task Scheduler
- Parallel Programming with Microsoft .Net : Parallel Tasks - Design Notes
- Parallel Programming with Microsoft .Net : Parallel Tasks - Anti-Patterns
- Parallel Programming with Microsoft .Net : Parallel Tasks - Variations (part 2)
- Parallel Programming with Microsoft .Net : Parallel Tasks - Variations (part 1)
- Parallel Programming with Microsoft .Net : Parallel Tasks - An Example
- Parallel Programming with Microsoft .Net : Parallel Tasks - The Basics
- jQuery 1.3 : The jQuery UI plugin library
- jQuery 1.3 : The Form plugin
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us